package com.leyou.item.mapper;

import com.leyou.common.mapper.BaseMapper;
import com.leyou.item.pojo.Stock;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.additional.insert.InsertListMapper;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.base.insert.InsertMapper;

/**
 * @author huangxin
 * @date 2019/4/28-20:45
 */
public interface StockMapper extends BaseMapper<Stock, Long> {
    @Update("UPDATE tb_stock SET stock = stock - #{num} WHERE sku_id=#{id} AND stock>= #{num}")
    int decreaseStock(@Param("id") Long id, @Param("num") Integer num);
}
